home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMM30_A.ASM < prev    next >
Assembly Source File  |  1989-11-29  |  8KB  |  135 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM30_A.ASM                                             ;
  3. ;                                                                             ;
  4. ; OS FUNCTION NAME:   enable_OS_fcns                                          ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function provides an OS/E with the ability to      ;
  7. ;                     enable all programs or device drivers to use the OS/E   ;
  8. ;                     specific functions.  The capability is provided ONLY    ;
  9. ;                     for an OS/E which manages regions of mappable           ;
  10. ;                     conventional memory and cannot permit programs to use   ;
  11. ;                     any of the functions which affect mappable conventional ;
  12. ;                     memory regions, but must be able to use these functions ;
  13. ;                     itself.  When an OS/E disables these functions and a    ;
  14. ;                     program attempts to use them, the memory manager        ;
  15. ;                     returns a status to the program indicating that the     ;
  16. ;                     OS/E has denied the program access to the function.  In ;
  17. ;                     other words, the functions will not work when disabled. ;
  18. ;                     However, all programs may use them when enabled.        ;
  19. ;                                                                             ;
  20. ;                     The OS/E (Operating System/Environment) functions this  ;
  21. ;                     function enables are:                                   ;
  22. ;                        get_hw_info               enable_DMA_reg_set         ;
  23. ;                        get_alt_reg_set           disable_DMA_reg_set        ;
  24. ;                        set_alt_reg_set           dealloc_DMA_reg_set        ;
  25. ;                        get_alt_context_size      enable_OS_fcns             ;
  26. ;                        alloc_alt_reg_set         disable_OS_fcns            ;
  27. ;                        dealloc_alt_reg_set       return_OS_access_key       ;
  28. ;                        alloc_DMA_reg_set                                    ;
  29. ;                                                                             ;
  30. ;                     It appears contradictory that the OS/E can re-enable    ;
  31. ;                     these functions when the function which re-enables them ;
  32. ;                     is itself disabled.  An overview of the process follows.;
  33. ;                                                                             ;
  34. ;                     The memory manager enables all the OS/E specific        ;
  35. ;                     functions, including this one, when it is loaded.  The  ;
  36. ;                     OS/E gets exclusive access to these functions by        ;
  37. ;                     invoking either of the Enable/Disable OS/E Function Set ;
  38. ;                     functions before any other software does.               ;
  39. ;                                                                             ;
  40. ;                     On the first invocation of either of these functions,   ;
  41. ;                     the memory manager returns an access_key which the OS/E ;
  42. ;                     must use in all future invocations of either of these   ;
  43. ;                     functions.  The memory manager does not require the     ;
  44. ;                     access_key on the first invocation of the               ;
  45. ;                     Enable/Disable OS/E Function Set functions.             ;
  46. ;                                                                             ;
  47. ;                     On all subsequent invocations, the access_key is        ;
  48. ;                     required for either the Enable or Disable OS/E Function ;
  49. ;                     Set functions.  Since the access_key is returned only   ;
  50. ;                     on the first invocation of the Enable/Disable OS/E      ;
  51. ;                     Function Set functions, and presumably the OS/E is the  ;
  52. ;                     first software to invoke this function, only the OS/E   ;
  53. ;                     obtains a copy of this key.  The memory manager must    ;
  54. ;                     return an access key with a random value, a fixed value ;
  55. ;                     key defeats the purpose of providing this level of      ;
  56. ;                     security for an OS/E.                                   ;
  57. ;                                                                             ;
  58. ;           PASSED:   &access_key:                                            ;
  59. ;                        is a far pointer to an access key which EMM will     ;
  60. ;                        initialize.  The OS/E must use this key whenever it  ;
  61. ;                        needs to access the OS/E specific EMM functions.     ;
  62. ;                                                                             ;
  63. ;         RETURNED:   status:                                                 ;
  64. ;                        is the status EMM returns from the call.  All other  ;
  65. ;                        returned results are valid only if the status        ;
  66. ;                        returned is zero.  Otherwise they are undefined.     ;
  67. ;                                                                             ;
  68. ;                     access_key:                                             ;
  69. ;                        is an EMM initialized access key which the OS/E must ;
  70. ;                        use whenever it needs to access the OS/E specific    ;
  71. ;                        EMM functions.  Returned only on the first function  ;
  72. ;                        invocation, the memory manager returns a random      ;
  73. ;                        valued key which will be required thereafter for the ;
  74. ;                        execution of this function.  On all invocations      ;
  75. ;                        after the first, the correct key is not returned.    ;
  76. ;                                                                             ;
  77. ; C USE CONVENTION:   unsigned int  status;                                   ;
  78. ;                     unsigned long access_key;                               ;
  79. ;                                                                             ;
  80. ;                     status = enable_OS_fcns (&access_key);                  ;
  81. ;-----------------------------------------------------------------------------;
  82. .XLIST
  83. PAGE    60,132
  84.  
  85. IFDEF SMALL
  86.    .MODEL SMALL, C
  87. ENDIF
  88. IFDEF MEDIUM
  89.    .MODEL MEDIUM, C
  90. ENDIF
  91. IFDEF LARGE
  92.    .MODEL LARGE, C
  93. ENDIF
  94. IFDEF COMPACT
  95.    .MODEL COMPACT, C
  96. ENDIF
  97. IFDEF HUGE
  98.    .MODEL HUGE, C
  99. ENDIF
  100.  
  101. INCLUDE emmlib.equ
  102. INCLUDE emmlib.str
  103. INCLUDE emmlib.mac
  104. .LIST
  105. .CODE
  106.  
  107. enable_OS_fcns        PROC                                                  \
  108.             USES DI,                                              \
  109.             ptr_access_key:FAR PTR DWORD
  110.  
  111.     ;---------------------------------------------------------------------;
  112.     ;   do;                                                               ;
  113.     ;   .   enable the OS related functions & obtain an "access key"      ;
  114.     ;   .   required for future use of these functions;                   ;
  115.     ;---------------------------------------------------------------------;
  116.     MOVE        AX, enable_os_fcn_set_fcn
  117.     MOVE        ES:DI, ptr_access_key
  118.     MOVE        BX:CX, ES:[DI]
  119.     INT         EMM_int
  120.  
  121.     ;---------------------------------------------------------------------;
  122.     ;   .   pass the "access key" back to the OS;                         ;
  123.     ;---------------------------------------------------------------------;
  124.     MOVE        ES:[DI], BX:CX
  125.  
  126.     ;---------------------------------------------------------------------;
  127.     ;   .   return (EMM status);                                          ;
  128.     ;   end;                                                              ;
  129.     ;---------------------------------------------------------------------;
  130.     RET_EMM_STAT    AH
  131.  
  132. enable_OS_fcns            ENDP
  133.  
  134. END
  135.